///1,Text
// 2,Image
// 3,Radio
// 4,Video
// 5,Like
// 6,Match
// 7,Wink
// 8,Private album request
// 9,Accept private album request
// 10,First date ideas
// 11,Recall
// 12,Request upload photo
// 13,Add free boosts
// 14,Upload photos (to who requested upload photo)
// 15,Private album has been updated
// 16,Video chat
// 17,Voice chat
// 18,Gift message
// 19,BoltImage //阅后即焚
// 20,Ice breaking quesion
// 21,PREMIUM upgrade to PREMIUM+
// 22,STANDARD upgrade to PREMIUM
// 23,like profile or like user's photo
// 24,System message adds page jump link
// 25,Predefined System message
// 26,Predefined System message
// 27,Graphic wink
// 28,Emoji
// 29,Accept chat invitation
// 30,Shared a chat background
// 31,Accepted the shared background
// 32,like itinerary
// 33,ask join itinerary
// 34,Restore the chat background to original
// 35,Reply to chatroom messages
// 36,like dine companion
// 37,ask join companion
// 38,contest share
// 49,要求认证的消息

enum IMMessageType {
  supportText,
  text,
  image,
  voice,
  video,
  like,
  match,
  wink,
  privateAlbumRequest,
  acceptPrivateAlbumRequest,
  firstDateIdeas,
  messageTypeRecall,
  messageTypeRequestUploadPhoto,
  messageTypeGetBoostByUpgrade,
  messageTypeInviteUploadPhotoChanges,
  messageTypeUploadPrivatePhotoNotifyOthers,
  messageTypeBolt,
  messageTypeTrtc,
  messageTypeTips,
  messageTypeForReceive,
  messageTypeUnknow,
  stickerIcon,
  reply,
  stickerAnim,
  customSticker,
  autoReply,
  themeChange,
  themeClear,
  likeCompanion,
  joinCompanion,
  rehostCompanion,
  inviteCompanion,
  approvedCompanion,
  verifyNotification,
  premiumWink,
}

extension IMMessageTypeExtension on IMMessageType {
  static const values = {
    IMMessageType.text: '1',
    IMMessageType.image: '2',
    IMMessageType.voice: '3',
    IMMessageType.video: '4',
    IMMessageType.like: '5',
    IMMessageType.match: '6',
    IMMessageType.wink: '7',
    IMMessageType.privateAlbumRequest: '8',
    IMMessageType.acceptPrivateAlbumRequest: '9',
    IMMessageType.firstDateIdeas: '10',
    IMMessageType.messageTypeRecall: '11',
    IMMessageType.messageTypeRequestUploadPhoto: '12',
    IMMessageType.messageTypeGetBoostByUpgrade: '13',
    IMMessageType.messageTypeInviteUploadPhotoChanges: '14',
    IMMessageType.messageTypeUploadPrivatePhotoNotifyOthers: '15',
    IMMessageType.messageTypeTrtc: '16',
    IMMessageType.messageTypeBolt: '19',
    IMMessageType.supportText: '22',
    IMMessageType.stickerIcon: '28',
    IMMessageType.reply: '35',
    IMMessageType.stickerAnim: '40',
    IMMessageType.customSticker: '43',
    IMMessageType.autoReply: '45',
    IMMessageType.themeChange: '30',
    IMMessageType.themeClear: '34',
    IMMessageType.likeCompanion: '32',
    IMMessageType.joinCompanion: '33',
    IMMessageType.rehostCompanion: '52',
    IMMessageType.inviteCompanion: '48',
    IMMessageType.approvedCompanion: '56',
    IMMessageType.verifyNotification: '49',
    IMMessageType.premiumWink: '59',
    IMMessageType.messageTypeTips: '110',
    IMMessageType.messageTypeForReceive: '5001',
    IMMessageType.messageTypeUnknow: '15001',
  };

  String get value => values[this] ?? '15001';
}

enum MessageStatusEnum {
  sending(1),
  success(2),
  failed(3),
  systemError(4),
  read(5);

  final int value;

  const MessageStatusEnum(this.value);

  @override
  String toString() => 'The $name type is $value';
}

enum ConnectionStatusEnum {
  connecting(0),
  connected(1),
  closed(2);

  final int value;

  const ConnectionStatusEnum(this.value);

  @override
  String toString() => 'The ConnectionStatusEnum $name value is $value';
}

enum MessageTypeEnum {
  connected("connected"),
  ping("ping"),
  pong("pong"),
  say("say"),
  sayToGroup("say_to_group"),
  recall("recall"),
  error("error"),
  report("report"),

  /// 连接IM时返回
  groupUid("group_uids"),
  joinGroup("join_group"),
  leaveGroup("leave_group"),
  groupConnected("group_connected"),
  groupError("group_error"),
//需要设置的状态.  //Chatroom online status, 1:Online, 2:Offline, 3:Invisible, 4:Busy, 5:Away
  setGroupStatus("set_group_status"),
//{type: "check_online", check_uid: 121625785}
//{type: "check_online", check_uid: 121625785, is_online: 0, time: 1654658574}
  checkOnline("check_online"),
  unKnow("un_know");

  final String value;

  const MessageTypeEnum(this.value);

  @override
  String toString() => 'The MessageTypeEnum $name value is $value';
}
